package cn.iocoder.yudao.module.member.dal.mysql.student;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.student.vo.StudentExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.student.vo.StudentInfoRespVO;
import cn.iocoder.yudao.module.member.controller.admin.student.vo.StudentPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.curriculumVitaeSendRecord.CurriculumVitaeSendRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.student.StudentDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 学生管理 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface StudentMapper extends BaseMapperX<StudentDO> {

    default StudentDO selectByMobile(String mobile) {
        return selectOne(StudentDO::getMobile, mobile,StudentDO::getDeleted,0);
    }

    default PageResult<StudentDO> selectPage(StudentPageReqVO reqVO) {
        return pageQuery(reqVO, new LambdaQueryWrapperX<StudentDO>()
                .likeIfPresent(StudentDO::getStudentName, reqVO.getStudentName())
                .likeIfPresent(StudentDO::getChecker, reqVO.getChecker())
                .inIfPresent(StudentDO::getStatus, reqVO.getStatus())
                .likeIfPresent(StudentDO::getMobile, reqVO.getMobile())
                .eqIfPresent(StudentDO::getInJobTime, reqVO.getInJobTime())
                .eqIfPresent(StudentDO::getJobStatus, reqVO.getJobStatus())
                .eqIfPresent(StudentDO::getStudentAbroad, reqVO.getStudentAbroad())
                .orderByDesc(StudentDO::getId));
    }


    default List<StudentDO> selectList(StudentExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<StudentDO>()
                .likeIfPresent(StudentDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(StudentDO::getStatus, reqVO.getStatus())
                .eqIfPresent(StudentDO::getMobile, reqVO.getMobile())
                .orderByDesc(StudentDO::getUpdateTime).orderByDesc(StudentDO::getId));
    }

    default StudentDO selectByPassword(String mobile,String password) {
        return selectOne(new LambdaQueryWrapperX<StudentDO>().eq(StudentDO::getMobile, mobile).eq(StudentDO::getPassword,password)
                );
    }
    List<StudentInfoRespVO> getStudentInfoPage(IPage page, @Param("request") Map<String, Object> request);
    List<StudentInfoRespVO> getPushStudentInfoPage(IPage page, @Param("request") Map<String, Object> request);

    Integer getStudentRegistCount(@Param("startDate") String startDate, @Param("endDate") String endDate);
}
